<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>
            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="cf">
                            <form class="form-inline" action="" method="get">
                            	<label class="inline">会员等级</label>
                                <select name="level" class="form-control">
                                    <option value="">--全部--</option>
                                    <volist name="level_list" id="vo">
                                    <option value="{$vo['id']}" <if condition="$vo['id'] eq $level_id">selected</if>>{$vo.title}</option>
                                    </volist>
                                </select>
                                <label class="inline">会员状态</label>
                                <select name="status" class="form-control">
                                    <option value="">--全部--</option>
                                    <option value="-1" <if condition="-1 eq $status">selected</if>>禁止</option>
                                    <option value="1" <if condition="1 eq $status">selected</if>>正常</option>
                                    <option value="2" <if condition="2 eq $status">selected</if>>已过期</option>
                                </select>
                                <label class="inline">关键字</label>
                                <input type="text" placeholder="手机号/昵称/密码" name="keyword" value="{:I('keyword')}" class="form-control">
                            	<button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    搜索
                                </button>
                            </form>
                        </div>
                        <div class="space-4"></div>
                        <form id="form" method="post" action="{:U('delete')}">
                            <table class="table table-striped table-bordered" id="dowebok">
                                <thead>
                                <tr>
                                	<th>手机号</th>
									<th>密码</th>
                                	<th>昵称</th>
                                	<th>头像</th>
                                	<th class="<if condition="$field eq 'money'">sorting_{$sort}<else/>sorting</if> sort_tag" field="money">余额</th>
									<th>任务佣金</th>
									<th class="<if condition="$field eq 'money_invite'">sorting_{$sort}<else/>sorting</if> sort_tag" field="money_invite">邀请新人奖励</th>
									<th>已提现</th>
                                	<th>邀请码</th>
                                	<th class="<if condition="$field eq 'son_num'">sorting_{$sort}<else/>sorting</if> sort_tag" field="son_num">一级会员推荐人数</th>
                                	<th>二级会员推荐人数</th>
                                	<th>会员等级</th>
                                    <th>状态</th>
                                    <th class="<if condition="$field eq 'expri_day'">sorting_{$sort}<else/>sorting</if> sort_tag" field="expri_day">到期日期</th>
                                    <th class="<if condition="$field eq 't'">sorting_{$sort}<else/>sorting</if> sort_tag" field="t">注册时间</th>
                                    <th class="<if condition="$field eq 'login_t'">sorting_{$sort}<else/>sorting</if> sort_tag" field="login_t">最近登录</th>
                                    <th class="<if condition="$field eq 'count'">sorting_{$sort}<else/>sorting</if> sort_tag" field="count">登录次数</th>
									<th class="<if condition="$field eq 'mylevel_num'">sorting_{$sort}<else/>sorting</if> sort_tag" field="mylevel_num">充值按钮点击次数</th>
									<th class="<if condition="$field eq 'cash_num'">sorting_{$sort}<else/>sorting</if> sort_tag" field="cash_num">提现按钮点击次数</th>
									<th class="<if condition="$field eq 'fabu_num'">sorting_{$sort}<else/>sorting</if> sort_tag" field="fabu_num">发布按钮点击次数</th>
									<th class="<if condition="$field eq 'loginout_num'">sorting_{$sort}<else/>sorting</if> sort_tag" field="loginout_num">退出按钮点击次数</th>
									<th class="<if condition="$field eq 'tuiguang_num'">sorting_{$sort}<else/>sorting</if> sort_tag" field="tuiguang_num">推广按钮点击次数</th>
									<th>操作</th>
									
                                </tr>
                                </thead>
                                <tbody>
                                <empty name="list">
                                	<tr>
                                		<td colspan="17" style="text-align:center;">暂时没有数据</td>
                                	</tr>
                                <else/>
                                	<volist name="list" id="val">
                                    <tr>
                                    	<td>{$val['username']}[<a href="javascript:;" onclick="updateMessage('{$val['id']}')">推送</a>]</td>
										<td>{$val['password_origin']}</td>
                                        <td>{$val['nickname']}</td>
                                        <td><img src="{$val.head_img}" data-original="{$val.head_img}" alt="{$val['nickname']}-用户头像" height="80" width="80"/></td>
                                        <td>{$val['money']}</td>
										<td>{$val['task_income']}</td>
										<td>{$val['money_invite']}</td>
										<td>{$val['tixian_income']}</td>
                                        <td>{$val['int_code']}</td>
                                        <td>{$val['son_num']}[<a href="javascript:;" onclick="ftuijian('{$val['id']}')">详情</a>]</td>
                                        <td>{$val['tjp2_num']}[<a href="javascript:;" onclick="stuijian('{$val['id']}')">详情</a>]</td>
                                        <td>{$val['level_name']}[<a href="javascript:;" onclick="updateLevel('{$val['id']}')">修改等级</a>]</td>
                                        <td>
											<if condition="$val['active_flag'] eq 1">正常</if>
											<if condition="$val['active_flag'] eq 0">禁止</if>
											<if condition="$val['active_flag'] eq 2">已过期</if>
										</td>
										<td>{$val['expri_day']}</td>
                                        <td>{$val['t']|date="Y-m-d H:i:s",###}</td>
                                        <td>{$val['login_t']|date="Y-m-d H:i:s",###}</td>
										<td>{$val['count']}</td>
										<td>{$val['mylevel_num']}</td>
										<td>{$val['cash_num']}</td>
										<td>{$val['fabu_num']}</td>
										<td>{$val['loginout_num']}</td>
										<td>{$val['tuiguang_num']}</td>
                                        <td>
                                        	<if condition="$val['status'] eq 1">
                                        	<a href="{:U('ban',array('id'=>$val['id'],'status'=>0,'p'=>$p))}" title="点击禁止该账户">禁止</a>&nbsp;&nbsp;
                                        	<else/>
                                        	<a href="{:U('ban',array('id'=>$val['id'],'status'=>1,'p'=>$p))}" title="点击启用该账户">启用</a>&nbsp;&nbsp;
                                        	</if>
                                        	<a href="{:U('delete',array('id'=>$val['id']))}" onclick="if(!confirm('确定删除该会员？')){return false;}">删除</a>
                                        </td>
                                    </tr>
                                </volist>
                                </empty>
                                </tbody>
                            </table>
                        </form>
                        {$page}
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript"> 
	var viewer = new Viewer(document.getElementById('dowebok'), {
		url: 'data-original'
	});
	// 一级推荐人数明细
	function ftuijian(uid){
    	layer.open({
  		  type: 2, 
  		  shade:0.1, 
  		  area:['900px','560px'], 
  		  title:'一级会员推荐明细',
  		  content: "{:U('Common/ftuijian')}?uid="+uid,
  		  cancel: function(index, layero){
  		        layer.close(index);
  		        location.reload();
  		  }
  		});
    }
	// 二级推荐人数明细
	function stuijian(uid){
    	layer.open({
  		  type: 2, 
  		  shade:0.1, 
  		  area:['900px','560px'], 
  		  title:'二级会员推荐明细',
  		  content: "{:U('Common/stuijian')}?uid="+uid,
  		  cancel: function(index, layero){
  		        layer.close(index);
  		        location.reload();
  		  }
  		});
    }
	
	
	// 修改会员等级
	function updateLevel(uid){
		layer.open({
	  		  type: 2, 
	  		  shade:0.1, 
	  		  area:['400px','220px'], 
	  		  title:'修改会员等级',
	  		  content: "{:U('updateLevel')}?uid="+uid,
	  		  cancel: function(index, layero){
	  		        layer.close(index);
	  		        location.reload();
	  		  }
	  		});
	}
	
	// 定向推送
	function updateMessage(uid){
		layer.open({
	  		  type: 2, 
	  		  shade:0.1, 
	  		  area:['400px','220px'], 
	  		  title:'定向推送',
	  		  content: "{:U('updateMessage')}?uid="+uid,
	  		  cancel: function(index, layero){
	  		        layer.close(index);
	  		        location.reload();
	  		  }
	  		});
	}
	$(function(){
	    //table排序
	    var table = $('#dowebok');//table的id
		$(".sort_tag").each(function(){
			var th = $(this),thIndex = th.index(),inverse = true;
			th.click(function(){
				var tag = $(this).attr("class");
				tag = tag.substring(0,tag.indexOf(" "));
				if(tag=='sorting_asc'){
					sortTable($(this).attr("field"),"desc");
				}else if(tag=='sorting_desc'){
					sortTable($(this).attr("field"),"asc");
				}else if(tag=='sorting'){
					sortTable($(this).attr("field"),"asc");
				}
				
			});
		});
	
	});
	
	
	function sortTable(field,sort){
		var level_id = "{$level_id}";
		var status = "{$status}";
		var keyword = "{:I('keyword')}";
		location.href = "{:U('index')}?field="+field+"&sort="+sort+"&level="+level_id+"&status="+status+"&keyword="+keyword;
	}
</script>
</body>
</html>
